// 数据类型定义
export interface Product {
  id: string;
  name: string;
  price: number;
  originalValue: string;
  description: string;
  category: 'virtual' | 'digital' | 'food' | 'anime';
  bgColor: string;
  stock: number;
  image: string;
  probability?: string;
}

export interface CartItem {
  product: Product;
  quantity: number;
}

export interface User {
  id: string;
  name: string;
  avatar: string;
  phone: string;
  email: string;
  balance: number;
  points: number;
  memberLevel: 'bronze' | 'silver' | 'gold' | 'diamond';
}

export interface Order {
  id: string;
  userId: string;
  items: CartItem[];
  total: number;
  status: 'pending' | 'paid' | 'shipped' | 'delivered' | 'completed';
  createdAt: string;
  trackingNumber?: string;
  unboxed?: boolean;
  unboxResult?: UnboxResult[];
}

export interface UnboxResult {
  id: string;
  orderId: string;
  productName: string;
  actualItem: string;
  actualValue: number;
  image: string;
  satisfaction: number;
  createdAt: string;
}

export interface Category {
  id: string;
  name: string;
  icon: string;
  description: string;
}

// 签到相关类型
export interface SignInRecord {
  userId: string;
  date: string; // YYYY-MM-DD 格式
  consecutiveDays: number;
  totalDays: number;
  lastSignInDate: string;
}

export interface SignInReward {
  day: number; // 连续签到天数
  type: 'points' | 'lottery_chance' | 'product';
  value: number; // 积分数量或抽奖次数
  description: string;
}

export interface LotteryPrize {
  id: string;
  name: string;
  type: 'product' | 'points' | 'discount';
  value: number; // 对于product类型，表示价值；对于points，表示积分数；对于discount，表示折扣百分比
  probability: number; // 中奖概率（0-1）
  description: string;
  image: string;
  bgColor: string;
}

export interface LotteryResult {
  id: string;
  userId: string;
  prizeId: string;
  prizeName: string;
  prizeType: 'product' | 'points' | 'discount';
  prizeValue: number;
  createdAt: string;
  claimed: boolean;
}

// 购买盲盒相关类型
export interface PurchasedBox {
  id: string;
  userId: string;
  productId: string;
  productName: string;
  productCategory: string;
  price: number;
  purchaseDate: string;
  isUnboxed: boolean;
  unboxResult?: BoxUnboxResult;
  orderId?: string;
  paymentMethod?: string;
  status?: string;
}

export interface BoxUnboxResult {
  id: string;
  purchasedBoxId: string;
  actualItem: string;
  actualValue: number;
  category: string;
  rarity: 'common' | 'rare' | 'epic' | 'legendary';
  description: string;
  image: string;
  satisfaction: number; // 1-5 星级
  unboxDate: string;
}